package com.wuwei.business.controller;

import com.wuwei.common.core.controller.BaseController;
import com.wuwei.common.core.domain.AjaxResult;
import com.wuwei.common.core.domain.entity.SysDept;
import com.wuwei.common.core.domain.model.LoginUser;
import com.wuwei.system.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 内容: SSM
 * 作者: weishao
 */
@RestController
@RequestMapping("business/dept")
public class DeptController extends BaseController {
    @Autowired
    private ISysDeptService deptService;

    // 写一个返回部门集合的方法即可

    /**
     * 多租户的系统
     * 管理来查询
     *
     * @return
     */
    @GetMapping("list")
    public AjaxResult loadDepts(){
        //获取当前用户
        LoginUser loginUser = getLoginUser();
        //查询部门
        List<SysDept> sysDepts =deptService.selectDeptsByLoginUser(loginUser);
        return AjaxResult.success(sysDepts);
    }
}
